<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionView::FileSystemResolver</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionView::FileSystemResolver 
            
                <span class="parent">&lt; 
                    
                    ActionView::PathResolver
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_view/template/resolver_rb.html">actionpack/lib/action_view/template/resolver.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>A resolver that loads files from the filesystem. It allows setting your own
resolving pattern. Such pattern can be a glob string supported by some
variables.</p>

<h4 id="label-Examples">Examples</h4>

<p>Default pattern, loads views the same way as previous versions of rails,
eg. when you’re looking for `users/new` it will produce query glob:
`users/new{.{en},}{.{html,js},}{.{erb,haml},}`</p>

<pre>FileSystemResolver.new(&quot;/path/to/views&quot;, &quot;:prefix/:action{.:locale,}{.:formats,}{.:handlers,}&quot;)</pre>

<p>This one allows you to keep files with different formats in separate
subdirectories, eg. `users/new.html` will be loaded from
`users/html/new.erb` or `users/new.html.erb`, `users/new.js` from
`users/js/new.erb` or `users/new.js.erb`, etc.</p>

<pre>FileSystemResolver.new(&quot;/path/to/views&quot;, &quot;:prefix/{:formats/,}:action{.:locale,}{.:formats,}{.:handlers,}&quot;)</pre>

<p>If you don’t specify a pattern then the default will be used.</p>

<p>In order to use any of the customized resolvers above in a <a
href="../Rails.html">Rails</a> application, you just need to configure
ActionController::Base.view_paths in an initializer, for example:</p>

<pre>ActionController::Base.view_paths = FileSystemResolver.new(
  Rails.root.join(&quot;app/views&quot;),
  &quot;:prefix{/:locale}/:action{.:formats,}{.:handlers,}&quot;
)</pre>

<h4 id="label-Pattern+format+and+variables">Pattern format and variables</h4>

<p>Pattern has to be a valid glob string, and it allows you to use the
following variables:</p>
<ul><li>
<p><code>:prefix</code> - usually the controller path</p>
</li><li>
<p><code>:action</code> - name of the action</p>
</li><li>
<p><code>:locale</code> - possible locale versions</p>
</li><li>
<p><code>:formats</code> - possible request formats (for example html, json,
xml...)</p>
</li><li>
<p><code>:handlers</code> - possible handlers (for example erb, haml,
builder...)</p>
</li></ul>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="FileSystemResolver.html#method-i-3D-3D">==</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="FileSystemResolver.html#method-i-eql-3F">eql?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="FileSystemResolver.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="FileSystemResolver.html#method-i-to_path">to_path</a>,
              </li>
            
              
              <li>
                <a href="FileSystemResolver.html#method-i-to_s">to_s</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(path, pattern=nil)
            
            <a href="FileSystemResolver.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9cb12265d8a08c219c82e4e4d305a6d60b0af35c/actionpack/lib/action_view/template/resolver.rb#L286" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/resolver.rb, line 286</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">pattern</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;path already is a Resolver class&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Resolver</span>)
  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">pattern</span>)
  <span class="ruby-ivar">@path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-3D-3D">
            
              <b>==</b>(resolver)
            
            <a href="FileSystemResolver.html#method-i-3D-3D" name="method-i-3D-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-eql-3F">
            
              <b>eql?</b>(resolver)
            
            <a href="FileSystemResolver.html#method-i-eql-3F" name="method-i-eql-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="FileSystemResolver.html#method-i-3D-3D">==</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-eql-3F_source')" id="l_method-i-eql-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9cb12265d8a08c219c82e4e4d305a6d60b0af35c/actionpack/lib/action_view/template/resolver.rb#L297" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-eql-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/resolver.rb, line 297</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">eql?</span>(<span class="ruby-identifier">resolver</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">resolver</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">to_path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">resolver</span>.<span class="ruby-identifier">to_path</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_path">
            
              <b>to_path</b>()
            
            <a href="FileSystemResolver.html#method-i-to_path" name="method-i-to_path" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_s">
            
              <b>to_s</b>()
            
            <a href="FileSystemResolver.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="FileSystemResolver.html#method-i-to_path">to_path</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_s_source')" id="l_method-i-to_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9cb12265d8a08c219c82e4e4d305a6d60b0af35c/actionpack/lib/action_view/template/resolver.rb#L292" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/template/resolver.rb, line 292</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_s</span>
  <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    